import request from "@/utils/request"

export default {
    addCart(username, gid, gcount, color, size) {
        return request({
            method: "post",
            url:  "/dev-api/shoppingcart/addcart",
            data: {
                username,
                gid,
                gcount,
                color,
                size
            }
        })
    },
    getCart(username) {
        return request({
            method: "get",
            url:  "/dev-api/shoppingcart/showcart",
            params: { username }
        })
    },
    changeCount(username, gid, gcount, color, size) {
        return request({
            method: "put",
            url:  "/dev-api/shoppingcart/editcart",
            data: {
                username,
                gid,
                gcount,
                color,
                size
            }
        })
    },
    delGoods(username, gid, color, size) {
        return request({
            method: "delete",
            url:  "/dev-api/shoppingcart/delcart",
            data: { username, gid, color, size }
        })
    },
    delCheckGoods(username) {
        return request({
            method: "delete",
            url:  "/dev-api/shoppingcart/delcheck",
            data: { username }
        })
    },
    changeCheck(username, gid, newcheck, color, size) {
        return request({
            method: "put",
            url:  "/dev-api/shoppingcart/ischeck",
            data: {
                username,
                gid,
                newcheck,
                color,
                size
            }
        })
    },
    changeAllCheck(username, newcheck) {
        return request({
            method: "put",
            url:  "/dev-api/shoppingcart/ischeck",
            data: {
                username,
                newcheck
            }
        })
    },
    addDingdan(username) {
        return request({
            method: "post",
            url:  "/dev-api/order/addorder",
            data: { username }
        })
    },
    getDingdan(username) {
        return request({
            method: "get",
            url:  "/dev-api/order/getorder",
            params: { username }
        })
    },
    delDingdan(username, gid, color, size) {
        return request({
            method: "delete",
            url:  "/dev-api/order/delorder",
            data: { username, gid, color, size }
        })
    }
}